package com.project.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;import com.project.entity.po.Comment;import java.util.List;

/**
 * @ProjectName:
 * @Package:
 * @ClassName:
 * @Author: ZhaoLongShi
 * @CreateDate:
 */
public interface CommentMapper extends BaseMapper<Comment> {
    /**
     * 评论
     *
     * @param comment
     * @return
     */
    int comment(Comment comment);

    /**
     * 获取所有评论（分页）
     *
     * @param current
     * @return
     */
    default Page<Comment> selectComment(int current,int size) {
        Page<Comment> page = new Page<>(current, size);
        QueryWrapper<Comment> qw = new QueryWrapper<>();
        qw.lambda().eq(Comment::getIsDel, 1);
        return this.selectPage(page, qw);
    }

    /**
     * 根据 ID删除评论
     *
     * @param isList
     * @return
     */
    int deleteCommentByIds(List<Long> isList);
}